"""
    操作yaml文件
"""
import json
import os

import yaml
from config import Base_Path

"""
    读取
"""
def read_yaml() ->{}:
    with open(Base_Path+"/data/temp/extract.yaml", 'r', encoding='utf8') as f:
        return yaml.load(f,yaml.FullLoader)

"""
    写入
"""
def write_yaml(data:dict):
    with open(Base_Path+"/data/temp/extract.yaml", 'w', encoding='utf8') as f:
        yaml.dump(data,f,allow_unicode=True)

"""
    清空
"""
def clear_yaml():
    with open(Base_Path+"/data/temp/extract.yaml", 'w', encoding='utf8') as f:
        f.truncate()
